Imports System.Web.Mail
Partial Class email
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Not Page.IsPostBack Then
            sendMail("ngminhy1@yahoo.com", "abv", "asdfas")
        End If
    End Sub
    Private Function sendMail(ByVal vAddress As String, ByVal vSubject As String, ByVal vContent As String) As Boolean
        Try
            Dim mailmsg As New MailMessage
            Dim objMail As SmtpMail
            mailmsg.Priority = MailPriority.Normal
            mailmsg.BodyFormat = MailFormat.Html
            mailmsg.From = "kdadmin@hcm.vnn.vn"
            mailmsg.To = vAddress
            mailmsg.Subject = vSubject
            mailmsg.Body = vContent
            objMail.SmtpServer = "smtp.hcm.vnn.vn"
            objMail.Send(mailmsg)
        Catch ex As Exception
            Response.Write(ex.ToString)
        Finally
            Response.Write("An email has been sent")
        End Try
    End Function
End Class
